﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Login.Master"
	CodeBehind="login.aspx.vb" Inherits="RWN.login1" %>

<%@ MasterType VirtualPath="~/Login.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script language="JavaScript">
	function ChangFormatID(txtbox) {
		var val = txtbox.value.replace('-', '');
		if (val.length < 10) {
			return;
		}
		txtbox.value = val.substr(0, 2) + '-' + val.substr(2);
	}

	function ChangFormatID_OnFocus(txtbox) {
		var lastCurPos = GetCursorLocation(txtbox);
		txtbox.value = txtbox.value.replace('-', '');

		if (document.selection) { //IE
			// Set focus on the element
			txtbox.focus();

			// Create empty selection range
			var oSel = document.selection.createRange();

			// Move selection start and end to 0 position
			oSel.moveStart('character', -txtbox.value.length);
			
			// Move selection start and end to desired position
			oSel.moveStart('character', lastCurPos);
			oSel.moveEnd('character', 0);
			oSel.select();

		}
		else if (txtbox.selectionStart || txtbox.selectionStart == '0') {//Firefox
			txtbox.selectionStart = 0;
			txtbox.selectionEnd = lastCurPos;
			txtbox.focus();
		}
	
	}

	function GetCursorLocation(CurrentTextBox) {
		var CurrentSelection, FullRange, SelectedRange, LocationIndex = -1;
		if (typeof CurrentTextBox.selectionStart == "number") {
			LocationIndex = CurrentTextBox.selectionStart;
		}
		else if (document.selection && CurrentTextBox.createTextRange) {
			CurrentSelection = document.selection;
			if (CurrentSelection) {
				SelectedRange = CurrentSelection.createRange();
				FullRange = CurrentTextBox.createTextRange();
				FullRange.setEndPoint("EndToStart", SelectedRange);
				LocationIndex = FullRange.text.length;
			}
		}
		return LocationIndex;
	}

</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
	<!--Box Login-->
	<div id="boxlogin">
		<div class="top">
			<img src="images/text-login.png" /></div>
		<div class="inform">
			<ul>
				<li>
					<label>
						รหัสนักธุรกิจ</label>
					<asp:TextBox ID="txtUserId" runat="server" MaxLength="20"  AutoCompleteType="Disabled" class="informin"></asp:TextBox>
					<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtUserId"
						ErrorMessage="*" ValidationGroup="validlogin"></asp:RequiredFieldValidator>
				</li>
				<li>
					<label>
						รหัสผ่าน</label>
					<asp:TextBox ID="txtPassword" runat="server" MaxLength="20" TextMode="Password" class="informin"></asp:TextBox>
					<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtPassword"
						ErrorMessage="*" ValidationGroup="validlogin"></asp:RequiredFieldValidator>
				</li>
				<li style="margin-left: 142px;">
					<!--<input name="" type="checkbox" value="" /> จำรหัสผ่าน-->
					<span class="mt"><a href="ForgetPassword.aspx">ลืมรหัสผ่าน ?</a></span> </li>
				<asp:Button CssClass="button" ID="btnLogin" runat="server" Text="เข้าสู่ระบบ" ValidationGroup="validlogin" />
					<br />
					<span class="mt">สำหรับนักธุรกิจที่เข้าระบบครั้งแรก ขอให้ใช้ password เป็นเลข 4 ตัวหลังของเลขที่บัตรประชาชนของท่าน</span>
			</ul>
		</div>
		
	</div>

	<!--End Box Login-->
	</asp:Content>
